package io.kumao.gateway.controller;

import io.kumao.gateway.filter.RedisRateLimitGlobalFilter;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

/**
 * 限流控制器
 *
 * @author 崔作利
 */
@RestController
@RequestMapping("/rate_limit")
public class RateLimitController {

    @Resource
    private RedisRateLimitGlobalFilter redisRateLimitGlobalFilter;

    @PostMapping("refresh")
    public Mono<Void> refresh() {
        redisRateLimitGlobalFilter.init();
        return Mono.empty();
    }
}
